package com.changgou.system.controller;

import com.changgou.common.pojo.Result;
import com.changgou.common.pojo.StatusCode;
import com.changgou.system.pojo.Admin;
import com.changgou.system.service.AdminService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@CrossOrigin
@RequestMapping("/admin")
public class AdminController {
    @Resource
    private AdminService adminService;

    /**
     * 登录
     * @param
     * @return void
     */
    @PostMapping("/login")
    public Result<Void> login(@RequestBody Admin admin){
        boolean login = adminService.login(admin);
        if(login){
            return new Result<>();
        }else{
            return new Result<>(false, StatusCode.LOGINERROR,"用户名或密码错误");
        }
    }


}
